package day9;
import java.util.Scanner;
public class Fangfa1 {
    int answer = -1;
    public void fun(){//显示所有客户信息
        for (int i=0;i<Jingtai.menus.length;i++){
            if (Jingtai.menus[i].getName()!=null)
                System.out.println("姓名为" +Jingtai.menus[i].getName() + "年龄为" + Jingtai.menus[i].getAge());
        }
        do {
            System.out.println("输入0返回:");
            Scanner scan = new Scanner(System.in);
            answer=scan.nextInt();
            if(answer!=0) {
                System.out.println("输入0返回:");
            }
        }while(answer!=0);
    }
    public  void fun1(){//添加客户信息
        for (int i=0;i<Jingtai.menus.length;i++){
            if (Jingtai.menus[i].getName()==null){
                System.out.println("请输入姓名");
                Scanner scanner1 = new Scanner(System.in);
                String num2 = scanner1.next();
                System.out.println("添加姓名为:"+num2);
                Jingtai.menus[i].setName(num2);
                System.out.println("请输入年龄");
                Scanner scanner2 = new Scanner(System.in);
                int num3 = scanner2.nextInt();
                System.out.println("添加年龄为:"+num3);
                Jingtai.menus[i].setAge(num3);
            }
        }
        do {
            System.out.println("输入0返回:");
            Scanner scan = new Scanner(System.in);
            answer=scan.nextInt();
            if(answer!=0) {
                System.out.println("输入0返回:");
            }
        }while(answer!=0);
    }
    public  void fun3(){//修改客户信息
        System.out.println("修改客户信息");
        for (int i=0;i<Jingtai.menus.length;i++){
            System.out.println("这里修改玉竹这个人的信息");
            if (Jingtai.menus[i].getName()!=null){
                if (Jingtai.menus[i].getName().equals("玉竹")){
                    System.out.println("请输入你修改的姓名");
                    Scanner scanner = new Scanner(System.in);
                    String s = scanner.next();

                    System.out.println("请输入你修改的年龄");
                    int s1 = scanner.nextInt();
                    Jingtai.menus[i].setName(s);
                    Jingtai.menus[i].setAge(s1);
                    System.out.println("姓名为" +Jingtai.menus[i].getName() + "年龄为" + Jingtai.menus[i].getAge());
                    return;
                }
            }
        }
        do {
            System.out.println("输入0返回:");
            Scanner scanner = new Scanner(System.in);

            answer=scanner.nextInt();
            if(answer!=0) {
                System.out.println("输入0返回:");
            }
        }while(answer!=0);
    }
    public  void fun4(){//查询客户信息
        System.out.println("客户信息为");
        for (int i=0;i<Jingtai.menus.length;i++){
            if (Jingtai.menus[i].getName()!=null)
                System.out.println("姓名为" +Jingtai.menus[i].getName() + "年龄为" + Jingtai.menus[i].getAge());
        }
        do {
            System.out.println("输入0返回:");
            Scanner scan = new Scanner(System.in);
            answer=scan.nextInt();
            if(answer!=0) {
                System.out.println("输入0返回:");
            }
        }while(answer!=0);

    }
    public int fun5(){//返回上层
        return 0;
    }
}
